<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@page import="login.itinerary"%>
<%@page import="sun.security.jca.GetInstance.Instance"%>
<%@ page import="java.util.*" %> 
<%@ page import="java.util.ArrayList" %>
<!--Page structure, html and css coded by MJ Terrell-->
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Travel Experts</title>
        <link rel="stylesheet" type="text/css" href="main.css" />
    </head>
    <body>
    
    <div id="container">
        <div id="header">Travel Experts
        	<div class="nav"><a href="index.jsp">Login</a>&nbsp;&nbsp |
                    <a href="register.jsp">&nbsp;&nbsp Register</a>&nbsp;&nbsp |
                    <a href="update.jsp">&nbsp;&nbsp Update</a>&nbsp;&nbsp; |
                    &nbsp;&nbsp Itinerary</div>
        </div>
        <div class="login">
                
        <div class="pickittransbox">
        <p>Choose a booking</p>
        <!--insert dropdown box that links to database and shows customer bookings
        Also nothing should show up here unless they have already logged in-->
     <form >   
        <select name="sel">
            
             <% 
             
                String nextItem;
                itinerary objItinerary = new itinerary();
                ArrayList bookingIds = objItinerary.getBookingIds();//objItinerary.getBookingIds();
                // out.println("STARTED RUNNING");
                // out.println(objItinerary.getBookingIds());

                Iterator it = bookingIds.iterator();  

                 while(it.hasNext())  
                    {             
                     nextItem = (String) it.next();  
           %> 
     
                <option><%= nextItem %></option>
     
                    <% } %>
     </select> 
     <input type="Submit" name="GO" value="GO" />
   </form>
        </div>

        
        <div class="itintransbox">
        <p>Your Travel Itinerary</p>
        <!--info from database will show here depending on the booking they choose-->
            <Form action="DisplayCar" method="post">
                 <%
                        ArrayList bookingDetails = null;
                        String bookId  = null;
                        String bookDate  = null;
                        String bookNO  = null;
                        String travellerCount  = null;
                        String CustomerId  = null;
                        String TriptypeId  = null;
                        String PackageId  = null;
             if(request.getParameter("sel") != null) {
                 itinerary objItinerary2 = new itinerary();
                bookingDetails = objItinerary2.getBookingDetails(request.getParameter("sel"));
                bookId  =(String) bookingDetails.get(0);
                bookDate  =(String) bookingDetails.get(1);
                bookNO  =(String) bookingDetails.get(2);
                travellerCount  =(String) bookingDetails.get(3);
                CustomerId  =(String) bookingDetails.get(4);
                TriptypeId  =(String) bookingDetails.get(5);
                PackageId  =(String) bookingDetails.get(6);
              %>
              <% } %>
<TABLE BORDER=0>

<TR>
     <TD>
         Booking Id 
    </TD>
    <TD>
<input type="text" name="dstart"  value ="<%= bookId%>" readonly="true"/>
     </TD>
</TR>
<TR>
     <TD>
         Booking Date
    </TD>
      <TD>
        <input type="text" name="dend"  value ="<%= bookDate%>"  readonly="true"/>
       </TD>
</TR>
<TR>
     <TD>
          Booking No 
    </TD>
    <TD>
      <input type="text" name="dend"  value ="<%= bookNO%>"  readonly="true"/>
    </TD>
</TR>
<TR>
     <TD>
         Travel Count
    </TD>
    <TD>
         <input type="text" name="dend"  value ="<%= travellerCount%>"  readonly="true"/>
    </TD>
</TR>
<TR>
     <TD>
         Customer Id 
    </TD>
    <TD>
        <input type="text" name="dend"  value ="<%= CustomerId%>"  readonly="true"/>
    </TD>
</TR>
<TR>
     <TD>
         Trip type Id
    </TD>
    <TD>
        <input type="text" name="dend"  value ="<%= TriptypeId%>"  readonly="true"/>
    </TD>
</TR>
<TR>
     <TD>
         Package Id
    </TD>
    <TD>
        <input type="text" name="dend"  value ="<%= PackageId%>"  readonly="true"/>
    </TD>
</TR>
<!--
<TR>
    <TD COLSPAN=2>
    <INPUT type="submit" value="Send">
    </TD>
</TR>
-->
</TABLE>
</Form>
            
        </div>
    </div>
    </body>
</html>

